package com.business.service.interfaced.impl;

import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;

import com.business.service.interfaced.StandardInManager;
import com.system.dao.DaoSupport;
import com.system.util.PageData;

/** 
 * 说明： 商品规格表
 * 创建人：zhaozhenhua
 * 创建时间：2018-01-26
 * @version
 */
@Service("standardInService")
public class StandardInService implements StandardInManager{

	@Resource(name = "daoSupport")
	private DaoSupport dao;
	
	/**新增
	 * @param pd
	 * @throws Exception
	 */
	public void save(PageData pd)throws Exception{
		dao.save("StandardInMapper.save", pd);
	}
	
	/**删除
	 * @param pd
	 * @throws Exception
	 */
	public void delete(PageData pd)throws Exception{
		dao.delete("StandardInMapper.delete", pd);
	}
	
	/**修改
	 * @param pd
	 * @throws Exception
	 */
	public void edit(PageData pd)throws Exception{
		dao.update("StandardInMapper.edit", pd);
	}
	
	
	/**列表(全部)
	 * @param pd
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	public List<PageData> listAll(PageData pd)throws Exception{
		return (List<PageData>)dao.findForList("StandardInMapper.listAll", pd);
	}
	
	/**通过id获取数据
	 * @param pd
	 * @throws Exception
	 */
	public PageData findById(PageData pd)throws Exception{
		return (PageData)dao.findForObject("StandardInMapper.findById", pd);
	}
	
	/**批量删除
	 * @param ArrayDATA_IDS
	 * @throws Exception
	 */
	public void deleteAll(String[] ArrayDATA_IDS)throws Exception{
		dao.delete("StandardInMapper.deleteAll", ArrayDATA_IDS);
	}

	/**
	 * 根据尺寸和颜色查询规格
	 */
	@Override
	public PageData getStandardBySize(PageData pd) throws Exception {
		return (PageData)dao.findForObject("StandardInMapper.getStandardBySize", pd);
	}

	/**
	 * 根据尺寸查询颜色 
	 */
	@SuppressWarnings("unchecked")
	@Override
	public List<PageData> getColorsBySize(PageData pd) throws Exception {
		return (List<PageData>)dao.findForList("StandardInMapper.getColorsBySize", pd);
	}

	/**
	 * 根据颜色查询尺寸 
	 */
	@SuppressWarnings("unchecked")
	@Override
	public List<PageData> getSizesByColor(PageData pd) throws Exception {
		return (List<PageData>)dao.findForList("StandardInMapper.getSizesByColor", pd);
	}

	
}

